<?php


namespace App\Models;


/**
 * App\Models\Permission
 *
 * @property int $id
 * @property int $parent_id 上级权限ID
 * @property string $name 权限名称
 * @property string $guard_name
 * @property string $slug
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\Spatie\Permission\Models\Permission[] $permissions
 * @property-read int|null $permissions_count
 * @property-read \Illuminate\Database\Eloquent\Collection|\Spatie\Permission\Models\Role[] $roles
 * @property-read int|null $roles_count
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\User[] $users
 * @property-read int|null $users_count
 * @method static \Illuminate\Database\Eloquent\Builder|Permission newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Permission newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Permission permission($permissions)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission query()
 * @method static \Illuminate\Database\Eloquent\Builder|Permission role($roles, $guard = null)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereGuardName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereParentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereSlug($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Permission whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class Permission extends \Spatie\Permission\Models\Permission
{

    /**
     * 系统自动默认权限
     * @return array
     * @author thanatos thanatos915@163.com
     */
    public function defaultPermission()
    {
        return [
            [
                'name' => '工作台',
                'children' => [
                    ['name' => '工作台', 'slug' => 'workspace'],
                    ['name' => '数据统计', 'slug' => 'statistical']
                ]
            ],
            [

                'name' => '系统设置',
                'children' => [
                    ['name' => '新增用户', 'slug' => 'user_create'],
                    ['name' => '查看用户', 'slug' => 'user_view'],
                    ['name' => '修改用户', 'slug' => 'user_update'],
                    ['name' => '删除用户', 'slug' => 'user_delete'],
                    ['name' => '冻结用户', 'slug' => 'user_freeze'],

                    ['name' => '新增角色', 'slug' => 'role_create'],
                    ['name' => '查看角色', 'slug' => 'role_view'],
                    ['name' => '修改角色', 'slug' => 'role_update'],
                    ['name' => '删除角色', 'slug' => 'role_delete'],
                    ['name' => '部门管理', 'slug' => 'department_manage'],
                ]
            ],
            [
                'name' => '客户管理',
                'children' => [
                    ['name' => '新增客户', 'slug' => 'customer_create'],
                    ['name' => '跟进客户', 'slug' => 'customer_follow'],
                    ['name' => '查看客户', 'slug' => 'customer_view'],
                    ['name' => '修改客户', 'slug' => 'customer_update'],
                    ['name' => '客户转移', 'slug' => 'customer_move'],
                    ['name' => '批量导入', 'slug' => 'customer_import'],
                    ['name' => '分配客户', 'slug' => 'customer_assigned'],
                    ['name' => '客户公海', 'slug' => 'customer_sea'],
                    ['name' => '团队目标', 'slug' => 'team_goals'],
                ]
            ]
        ];
    }


}
